#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {
	FILE* pf = fopen("text.txt", "w+");
	int a = fwrite("aaaaa", 1, 4, pf);
	rewind(pf);

	char ch = 0;
	while ((ch = fgetc(pf)) != EOF) {
		putchar(ch);
	}

	fclose(pf);
	return 0;
}